<?php
$this->breadcrumbs=array(
	'Medias'=>array('index'),
	'Create',
);

$this->menu=array(
	array('label'=>'List Media', 'url'=>array('index')),
	array('label'=>'Manage Media', 'url'=>array('admin')),
);
?>

<script type="text/javascript">
<!--
$(function(){
	$("#product_submit").click(function(){

		$.get('<?php echo $this->createUrl('category/getcontenttype');?>',{
			'id':$("#Media_media_cid").val()
		},function(msg){
			if(msg == '<?php echo Category::CONTENT_GALLERY?>'){

				if($("#Media_media_name").val() == ''){
					$.msgbox({
						height:100,
					    width:250,
					    content:{type:'alert', content:'图集名称不能为空！'},
					    animation:4

					}); 					
				}else if($("#Media_media_describe").val() == ''){
					$.msgbox({
						height:100,
					    width:250,
					    content:{type:'alert', content:'图集描述不能为空！'},
					    animation:4

					}); 
				}else{
					$.post('<?php echo $this->createUrl('media/create');?>',{	
	//						'Media[media_id]':$("#Media_media_id").val(),
							'Media[media_name]':$("#Media_media_name").val(),
							'Media[media_cid]':$("#Media_media_cid").val(),				
							'Media[media_iscomment]':$("#Media_media_iscomment").val(),
							'Media[media_status]':$("#Media_media_status").val(),
							'Media[media_describe]':$("#Media_media_describe").val(),
							'Media[media_recommend]':$("#Media_media_recommend").val(),
				
						},function(msg){
//							$(".column2:last").html(msg);
//							alert(msg);
							location.href=msg;
					});
				}

			}else{
				$.msgbox({
					height:100,
				    width:250,
				    content:{type:'alert', content:'此分类不能创建图集！'},
				    animation:4

				}); 
			}
		});
		

	});

	
});


function func_update(id){
	var object = id.parent().siblings(".thumbnail");
	var src = id.attr("id");

	location.href = src;
//	$.colorbox({iframe:true, width:'90%', height:'90%',href:src,onClosed:function(){ load(); }});
	
}



function func_folder(id){
	var object = id.parent().siblings(".thumbnail");
	var id = object.find("a").attr("id");
	
	var src = object.find("img").attr("src");
	$("#pro_pic_id").attr("src",src);

//	$.get('{$this->createUrl('folder',array('id'=>$_GET['id']))}',{'fid':id},function(msg){
//		if(msg == "ok"){
//			alert("封面设置成功!");
//		}
//		
//	});	
}

function func_show(id){

	var object = id.parent().siblings(".thumbnail");
	var src = object.find("img").attr("src");
	src = src.replace('_thumb','');
	$.colorbox({href:src,slideshow:true});
	return false;
}

function func_showImg(id){

	var src = id.attr("name");

	$.colorbox({href:src, height:'95%'});
	return false;
}

function func_showInfo(id){
	var src = id.attr("name");
	$.colorbox({iframe:true, innerWidth:425, innerHeight:444,href:src});
	return false;
}
//-->
</script>
<div class="column1">
	<div class="box">
		<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>Yii::t('media','Create Gallery'),	));?>
			<div class="box-content">
				<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
			</div>
		<?php $this->endWidget();?>
	</div>	
</div>
<div class="column2">
	<div class="box">
		<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>Yii::t('media','Gallery Info'),	));?>
			<div class="box-content">
				<?php $this->widget('zii.widgets.CListView', array(
					'dataProvider'=>$dataProvider,
					'itemView'=>'_pview',
				)); ?>
				<hr class="space" />				
			</div>
			
		<?php $this->endWidget();?>
	</div>
	
</div>

<?php $this->widget('ext.box.colorbox.colorboxWidget',array(
		'id'=>'.various1',
		'theme'=>'example1',
//		'options'=>'width:"50%", inline:true, href:"#uploadbox",onClosed:function(){ load(); }'
));?>